package com.lemon.controller;
import com.lemon.domain.OutboundOrderDetails;
import com.lemon.domain.PageResult;
import com.lemon.service.OutboundOrderDetailsService;
import com.lemon.service.impl.OutboundOrderDetailsServiceImpl;
import com.lemon.domain.Result;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import org.springframework.beans.factory.annotation.Autowired;

import java.util.Date;
import java.util.List;

/**
 * 出库单明细(outbound_order_details)表控制层
 *
 * @author xxxxx
 */
@RestController
@RequestMapping("/outbound_order_details")
@RequiredArgsConstructor
public class OutboundOrderDetailsController {
    /**
     * 服务对象
     */
    private final OutboundOrderDetailsService outboundOrderDetailsService;

    @PutMapping
    public Result jianhuo(Long outboundOrderDetailsId,Integer status){
        outboundOrderDetailsService.jianhuo(outboundOrderDetailsId, status);
        return Result.success();
    }

    @GetMapping("/status")
    public Result getPage(Integer page, Integer pageSize, String invoiceCode,Integer  status){
        PageResult pageResult = outboundOrderDetailsService.getPage(page, pageSize, invoiceCode, status);
        return Result.success(pageResult);
    }

    @GetMapping("/{outboundOrderId}")
    public Result getList(@PathVariable Long outboundOrderId) {
        List<OutboundOrderDetails> list = outboundOrderDetailsService.getList(outboundOrderId);
        return Result.success(list);
    }

}
